//
//  ViewController.m
//  流媒体_学习
//
//  Created by macOS on 2017/4/22.
//  Copyright © 2017年 macOS. All rights reserved.
//

#import "ViewController.h"

#import <MediaPlayer/MediaPlayer.h>

#import <AVFoundation/AVPlayer.h>

@interface ViewController ()

@property (nonatomic , strong) NSURL *url;

@property (nonatomic , strong) MPMoviePlayerController *mpc;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
  
    
    self.url = [NSURL URLWithString:@"http://devstreaming.apple.com/videos/wwdc/2015/408509vyudbqvts/408/hls_vod_mvp.m3u8"];
    
    
}


- (IBAction)mpc_Click:(id)sender {
    
    self.mpc = [[MPMoviePlayerController alloc] initWithContentURL:self.url];
    
    self.mpc.view.frame = CGRectMake(0, 400, 375, 200);
    
    [self.view addSubview:self.mpc.view];
    
    
}

- (IBAction)mpvc_click:(id)sender {
   self.mpc = [[MPMoviePlayerController alloc] initWithContentURL:self.url];
   [self presentMoviePlayerViewControllerAnimated:self.mpc];
    
    
}
- (IBAction)AV_click:(id)sender {
    
    AVPlayerItem *item = [[AVPlayerItem alloc] initWithURL:self.url];
    
    AVPlayer *player = [[AVPlayer alloc] initWithPlayerItem:item];
    AVPlayerLar *layer = [AVPlayer playerWithURL:self.url];
    
    [self.view.layer addSublayer:layer];
    
    
    
}

@end
